import random

#定义批量生成随机数的类
class Randomtest:
    def __init__(self):
        pass

    def batchnum(self, rangemin=0, rangemax=50, num=5):
   
        width = rangemax - rangemin
        if width < num:
            raise ValueError("num is larger than \"rangemax - rangemin\".")

        numbers = [random.randint(rangemin, rangemax) for x in range(num)]

        return numbers

#定义生成坐标的函数
def generate_coordinates(*args):

    list1 = list(args)
    #如果传入参数的数量为单数则移除一个
    if len(list1)%2 == 1:
        list1.pop()

    coordinates = list()

    for x in range(0,len(list1)//2):
        a = 0
        coordinate_x = list()
        while a < 2:
            coordinate_x.append(list1.pop())
            a += 1
        coordinates.append(tuple(coordinate_x))

    return coordinates


#测试验证
n1 = Randomtest()

numberlist = n1.batchnum(rangemin=-100,rangemax=50,num=12)

print(generate_coordinates(*numberlist))


#做的不错